home *** CD-ROM | disk | FTP | other *** search
- package netscape.javascript;
-
- import java.applet.Applet;
- import opera.PluginContext;
-
- public final class JSObject {
- private int js_object;
- private int doc_ptr;
- private Object result;
-
- private JSObject(int var1, int var2) {
- this.js_object = var1;
- this.doc_ptr = var2;
- this.ref();
- }
-
- public Object call(String var1, Object[] var2) throws JSException {
- try {
- synchronized(this) {
- JSObject var4 = (JSObject)this.getMember(var1);
- if (var4 != null) {
- if (this.startCall(var4, var2)) {
- this.wait();
- if (this.result instanceof JSException) {
- throw (JSException)this.result;
- }
- } else {
- this.result = null;
- }
-
- Object var5 = this.result;
- return var5;
- } else {
- throw new JSException("Method " + var1 + " not found.");
- }
- }
- } catch (InterruptedException var8) {
- return null;
- }
- }
-
- private native boolean startCall(JSObject var1, Object[] var2);
-
- public Object eval(String var1) throws JSException {
- try {
- synchronized(this) {
- if (this.startEval(var1)) {
- this.wait();
- if (this.result instanceof JSException) {
- throw (JSException)this.result;
- }
- } else {
- this.result = null;
- }
-
- Object var3 = this.result;
- return var3;
- }
- } catch (InterruptedException var6) {
- return null;
- }
- }
-
- private native boolean startEval(String var1);
-
- public static JSObject getWindow(Applet var0) throws JSException {
- PluginContext var1 = (PluginContext)var0.getAppletContext();
- if (var1 != null) {
- int var2 = var1.getJSWindow();
- if (var2 != 0) {
- return new JSObject(var2, var1.getDocumentPtr());
- }
- }
-
- return null;
- }
-
- public native Object getMember(String var1);
-
- public native void setMember(String var1, Object var2);
-
- public native void removeMember(String var1);
-
- public native Object getSlot(int var1);
-
- public native void setSlot(int var1, Object var2);
-
- public String toString() {
- try {
- Object var1 = this.eval("this.toString()");
- return var1 != null && var1 instanceof String ? (String)var1 : null;
- } catch (JSException var2) {
- return null;
- }
- }
-
- protected void finalize() {
- try {
- this.unref();
- super.finalize();
- } catch (Throwable var2) {
- }
-
- }
-
- private native void ref();
-
- private native void unref();
-
- private void setResult(Object var1) {
- synchronized(this) {
- this.result = var1;
- this.notify();
- }
- }
-
- private void setExceptionResult() {
- this.result = new JSException("JavaScript exception");
- }
- }
-